home *** CD-ROM | disk | FTP | other *** search
/ CD ROM Paradise Collection 4 / CD ROM Paradise Collection 4 1995 Nov.iso / program / swags_z.zip / STRINGS.SWG / 0062_Convert Numbers to STRING.pas < prev    next >
Pascal/Delphi Source File  |  1993-11-02  |  811b  |  33 lines

  1. {
  2. MIKE COPELAND
  3.  
  4. > Does anybody know how to make a variable for a procedure or
  5. > function use the special formatting like the write procedure?
  6. > I can;t figure this out after several weeks of investigation..
  7. > the str function is too 'clunky' is that the only way to do
  8. > this?
  9.  
  10.    Write yourself a function which invokes the Str procedure.  Such a
  11. routine should be in your global Unit, so you can access for every/any
  12. program you create.  Here are mine:
  13. }
  14.  
  15. function FSI(N : Longint; W : byte) : string;    { Convert LongInt to String }
  16. var
  17.   S : string;
  18. begin
  19.   if W > 0 then
  20.     Str(N : W, S)
  21.   else
  22.     Str(N, S);
  23.   FSI := S;
  24. end;
  25.  
  26. function FSR(N : real; W, D : byte) : string;        { Convert Real to String }
  27. var
  28.   S : string;
  29. begin
  30.   Str(N : W : D, S);
  31.   FSR := S;
  32. end;
  33.